<!DOCTYPE html>
<html lang="en">
<head>
	<{include file="header.html"}>
	<title>课程管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
		<link href="/static/public/webupload/webuploader.css" rel="stylesheet">
	</head>
<body>
<div class="wrap">
	<!--star left-->
	<div class="column">
		<{include file="left_menu.html"}>
	</div>
	<div id="ContMianBox">
		<!--star子栏目-->
			<div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
			<!--end子栏目-->
			<!--end left-->
			<div class="container narrow">
			    <!--star conter-->
			    <div class="cetContent">
					<div class="tit p-lr20">
					    <a class="c-40d064" href="/course_banke">面授课</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>编辑面授课</em>
					</div>
						<!--star内容区域-->
					<div class="mainScroll">
					    <div class="mainContainer line-all">
					        <div class="tabMainCont">
					            <!--star 编辑基本信息-->
					            <div class="tabItem step-02">
									<input type="hidden" id="token" value="<{$token}>">
									<form action="/course_banke/edit/<{$course_id}>" method="post" class="layui-form">
									<div class="hide" id="img_url_list"></div>
									<div class="layui-form-item">
									 <label class="layui-form-label">班课标题：</label>
									 <div class="layui-input-block">
										 <input type="text" name="title" value="<{if isset($title)}><{$title}><{/if}>" placeholder="请输入班课标题" required  lay-verify="required" autocomplete="off" class="layui-input">
										 <{if isset($title_err)}>
										<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
										<span class="tip" style=" padding:2px 5px;"><{$title_err}></span>
										<{/if}>
									 </div>
									</div>
									<script>var fileNumLimit = 6;</script>
									<div class="layui-form-item">
									<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
									 <label class="layui-form-label">班课图片：</label>
									 <div class="layui-input-block">
										<div class="layui-input-block" style="margin-top: 5px;">
											<div id="uploader2" class="upload_box" style="float:left; width:420px;">
												<div class="queueList">
													<div id="dndArea2" class="placeholder dndArea">
														<div id="filePicker2" class="filePicker"></div>
														<p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
													</div>
												</div>
												<div class="statusBar" style="display:none;">
													<div class="progress">
														<span class="text">0%</span>
														<span class="percentage"></span>
													</div><div class="info"></div>
													<div class="btns">
														<div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
													</div>
												</div>
												<div class="upload_img_input" input_name='course_imgs[]'></div>
											</div>
											<{if !empty($img_url)}>
												<{foreach from=$img_url item=img}>
												<div class="layui-inline" style="float:left;"><img src="<{$img}>" style="max-height:175px;"/>
												<input type="hidden" name="course_imgs[]" value="<{$img}>">
												</div>
												<{/foreach}>
											<{/if}>
										</div>

										 <{if isset($img_url_err)}>
									 	<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
									 	<span class="tip" style=" padding:2px 5px;"><{$img_url_err}></span>
									 	<{/if}>
										<div class="layui-form-mid layui-word-aux">提示：班课图片尺寸建议：400*300(4:3)，最多上传6张，第一张为主图</div>
									 </div>
									</div>
									<div class="layui-form-item">
								    <label class="layui-form-label">总课时：</label>
								    <div class="layui-input-inline">
								      <input type="text" name="course_time" maxlenght="3" value="<{if isset($course_time)}><{$course_time}><{/if}>" required lay-verify="required" placeholder="总课时" autocomplete="off" class="layui-input">
											<{if isset($course_time_err)}>
											<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
											<span class="tip" style=" padding:2px 5px;"><{$course_time_err}></span>
											<{/if}>
										</div>
								    <div class="layui-form-mid layui-word-aux">课时</div>
								  </div>
									<div class="layui-form-item">
								    <label class="layui-form-label">价格：</label>
								    <div class="layui-input-inline">
								      <input type="text" name="price" value="<{if isset($price)}><{$price}><{/if}>" maxlenght="8"  placeholder="价格" autocomplete="off" class="layui-input">
											<{if isset($price_err)}>
											<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
											<span class="tip" style=" padding:2px 5px;"><{$price_err}></span>
											<{/if}>
										</div>
								    <div class="layui-form-mid layui-word-aux">元（价格为0则不展示价格）</div>
								  </div>
								  <div class="layui-form-item">
	                    <label class="layui-form-label">课程分类：</label>
	                    <div class="layui-input-inline">
	                        <select name="cate_id" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
	                            <option value="">课程分类</option>
	                            
	                            <{foreach from=$cate_list item=item}>
	                                <option value="<{$item.id}>" <{if $cate_id|default: "" eq $item.id}>selected="selected"
	                                    <{/if}>><{$item.name}></option>
	                                <{/foreach}>
	                        </select>
	                    </div>
	                    <div class="layui-form-mid layui-word-aux">
	                        还没有课程分类，请<a href="/offline_course/cate_add" class="c-52a1fa">添加课程分类</a>
	                    </div>
	                </div>
	                <div class="layui-form-item">
	                    <label class="layui-form-label">课程科目：</label>
	                    <div class="layui-input-block" id="kemu_list">
	                    	<{if empty($course_list) }>
	                    	<div class="layui-form-mid layui-word-aux">
	                        还没有课程科目，请<a href="/offline_course/course_add" class="c-52a1fa">添加课程科目</a>
	                    	</div>
	                    	<{else}>
	                        <{foreach from=$course_list item=item}>
	                        	<input type="checkbox" name="subject[]" <{if !empty($subject) && in_array($item[ 'id'], $subject)}> checked
	                            <{/if}>  title="<{$item[ 'title']}>" value="<{$item['id']}>">
	                            
	                        <{/foreach}>
	                        <{/if}>
	                        <{if isset($subject_err)}>
	                            <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
	                           <{$subject_err}>
	                        <{/if}>
	                    </div>
	                </div>
	                <div class="layui-form-item">
						<label class="layui-form-label">推荐该课程:</label>
						<div class="layui-input-inline">
						<input type="checkbox" value="1" <{if $is_recomend|default:0 eq 1}>checked<{/if}> name="is_recomend" title="推荐" lay-skin="primary">
						</div>
					</div>
					<div class="layui-form-item">
					    <label class="layui-form-label">开班人数：</label>
					    <div class="layui-input-inline">
					      <input type="text" name="class_number" maxlength="3" value="<{if isset($class_number)}><{$class_number}><{/if}>"  placeholder="开班人数" autocomplete="off" class="layui-input">
								<{if isset($class_number_err)}>
								<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
								<span class="tip" style=" padding:2px 5px;"><{$class_number_err}></span>
								<{/if}>
							</div>
					    <div class="layui-form-mid layui-word-aux">人</div>
				  	</div>
					<div class="layui-form-item">
					 <label class="layui-form-label">适合人群：</label>
					 <div class="layui-input-block">
						 <input type="text" name="suitable" value="<{if isset($suitable)}><{$suitable}><{/if}>" placeholder="适合人群" autocomplete="off" class="layui-input">
						 <{if isset($suitable_err)}>
						 <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
						 <span class="tip" style="padding:2px 5px;"><{$suitable_err}></span>
						 <{/if}>
					 </div>

					</div>
					<div class="layui-form-item layui-form-text">
					 <label class="layui-form-label">学到什么：</label>
					 <div class="layui-input-block">
						 <textarea placeholder="能学到什么" name="learn_what" class="layui-textarea"><{if isset($learn_what)}><{$learn_what}><{/if}></textarea>
						 <{if isset($learned_err)}>
						 <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
						 <{$learned_err}>
						 <{/if}>
					 </div>

					</div>
				
					<div class="layui-form-item layui-form-text">
				 		<label class="layui-form-label">课程描述</label>
					 	<div class="layui-input-block">
					 		<textarea placeholder="请输入内容" id="editor" name="detail" class="layui-textarea editor"><{if isset($detail)}><{$detail}><{/if}></textarea>
						 	<{if isset($desc_err)}>
						 	<i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
							<span class="tip" ><{$desc_err}></span>
							<{/if}>
					 	</div>


					</div>
					<div class="layui-form-item">
					 <div class="layui-input-block">
						 <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
						 <button type="reset" class="layui-btn layui-btn-primary">取消</button>
					 </div>
					</div>
		            </form>
		            </div>
						            <!--end 编辑基本信息-->
			        </div>


				    </div>
				</div>
						<!--end内容区域-->

			</div>


		</div>
	</div>
<{include file="footer.html"}>
<script>
$(function(){
	//Demo
	layui.use(['form','jquery'], function(){
	  var form = layui.form();

	  form.on('select(cate_id)', function(data){
                    var ii = layer.load();
                    var id = data.value;

                    $("#kemu_list").html('');
                    form.render('checkbox');
                    $.ajax({
                        type: "POST",
                        url: "/course_banke/get_o2o_course_list_ajax/"+id,
                        dataType: "json",
                        success: function (data) {
                        	if(data==""){
                        		$("#kemu_list").html('<div class="layui-form-mid layui-word-aux">还没有课程科目，请<a href="/offline_course/course_add" class="c-52a1fa">添加课程科目</a></div>');
                        		// alert(data);
                        	}else{
                        		// var ddl = $("#subject");
	                            var html ='';
	                            $(data).each(function (key) {
	                                html += '<input type="checkbox" name="subject[]"  title="'+data[key].title+'" value="'+data[key].id+'">';
	                            });
	                            $("#kemu_list").html(html);
	                            form.render('checkbox');
	                            
                        	}

                        	layer.close(ii);
                        	
                            
                        }
                    });
                }); //ajax获取线下课程科目
	  //监听提交
	  // form.on('submit(formDemo)', function(data){
	  //   layer.msg(JSON.stringify(data.field));
	  //   return false;
	  // });
	});



})
</script>
</body>
</html>
